package guoanmaker.operator.business.repository;


import guoanmaker.operator.business.model.OperatorHotServer;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 *  
 *
 * @author huZhaoyu 
 * @ClassName: OperatorHotServerRepository
 * @Description: 热门服务Repository
 * @date 2017/6/29
 */
public interface OperatorHotServerRepository extends JpaRepository<OperatorHotServer, String>, JpaSpecificationExecutor<OperatorHotServer> {
    //	@Query("select u from OperatorUser u left join fetch u.roles r where u.username=:username")
//    public Optional<OperatorUser> findByUsername(@Param("username") String username);
    Integer countAllByIdIsNotNull();
    @Query("select u from OperatorHotServer u  where u.cityId=:cityId")
    public List<OperatorHotServer> findBycityCode(@Param("cityId") String cityId);
    
	@Query("select u from OperatorHotServer u  where u.serverId=:serverId")
 public OperatorHotServer findByserverId(@Param("serverId") String serverId);
	
	  @Query("select u.serverId,u.iconPath from OperatorHotServer u  where u.cityId=:cityId")
	    public List<OperatorHotServer> findBycityCodedeleId(@Param("cityId") String cityId);
}